{extend name="../../index/view/public/mlay" /}
{block name="style"}
{/block}
{block name="header"}{/block}
{block name="container"}
<div class="weui-form">
	<div class="weui-form__text-area">
	  <h2 class="weui-form__title">验证用户</h2>
	  <div class="weui-form__desc"></div>
	</div>
    <div class="weui-form__control-area">
      <div class="weui-cells__group weui-cells__group_form">
        <div class="weui-cells__title">用户资料</div>
        <div class="weui-cells weui-cells_form">
          <div class="weui-cell weui-cell_active">
            <div class="weui-cell__hd"><label class="weui-label">用户名</label></div>
            <div class="weui-cell__bd">
                <input id="username" class="weui-input" placeholder="填写本人用户名/手机号">
            </div>
          </div>
          <div class="weui-cell weui-cell_active">
            <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
            <div class="weui-cell__bd">
                <input id="password" name="password" class="weui-input" type="password" placeholder="填写系统分配的秘钥">
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="weui-form__opr-area">
      <a class="weui-btn weui-btn_primary" href="javascript:" id="signin">确定</a>
    </div>
  </div>
{/block}
{block name="copyright"}{/block}
{block name="page-footer"}{/block}
{block name="wxscript"}
{notempty name="jssdk"}
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script>
  wx.config({
    debug: false,
    appId: '{$jssdk.appid}',
    timestamp: '{$jssdk.timestamp}',
    nonceStr: '{$jssdk.noncestr}',
    signature: '{$jssdk.signature}',
    jsApiList: [
	  'closeWindow',
	  'hideAllNonBaseMenuItem',
    ]
  });
  wx.ready(function () {
	wx.hideAllNonBaseMenuItem();
  });
</script>
{/notempty}
{/block}
{block name="script"}
<script>
$(document).ready(function(){
	$("#signin").on("click", function(){
		var data = {
			username : $("input#username").val(),
			password : $("input[name='password']").val(),
		}
		$.post('', data, function(res){
			if(res.code == 0){
				weui.topTips(res.msg, {className: 'warning'});
			}else{
				weui.topTips(res.msg, {className: 'success'});
				// 关闭窗口
				var colse = function(){
					wx.closeWindow();
				}
				setTimeout(colse, 1000);
			}
		}
		);
	 })
})
</script>
{/block}